package pack0603;


import java.util.Scanner;

public class DemoG {
    public static void main(String[] args) {
        //按Y键继续,按任意键推出
        Scanner sun=new Scanner(System.in);
        System.out.println("按y开始,按任意键结束");
        String flag =sun.next();
        while ("y".equals(flag)||"Y".equals(flag)){
            System.out.println("☆");
            System.out.println("按y开始,按任意键结束");
            flag=sun.next();
        }

         //计算1-100的偶数和 减掉1-100的3的倍数的和
        //1
        int a=0;
        int res =0;//定义一个和
        while(a<=100){
            res=res+a;//求和res+=a;
            a = a+2;
        }
        System.out.println(res);

        int num=1;
        int sum=0;
        int sum1=0;
        int num1=1;
        while(num<=100){
            if (num%2==0){ //判断奇偶性
                sum=sum+num;
            }
            num++; //sum递增
        }
        while(num1<=100){
            if(num1%3==0){
                sum1=sum1+num1;
            }
            num1++;
        }
        System.out.println(sum);
        System.out.println(sum1);
        System.out.println(sum-sum1);

        //2
        int num2=1;
        int sum2=0;
        while(num2<=100){
            if (num2%3==0){
                sum2-=num2;
            }
            if (num2%2==0){
                sum2+=num2;
            }
            num2++;
        }
        System.out.println(sum2);


        int b=1;
        while(b<=50){
            if (b%5==0){
                System.out.println("☆");//换行
            }else{
                System.out.print("☆");
            }
            b++;
        }


    }
}
